package com.example.ywr.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 商品实体类
 */
@Data
@Entity
@Table(name = "product")
@EqualsAndHashCode(callSuper = true)
public class Product extends BaseEntity {

    /**
     * 商品名称
     */
    @Column(name = "name", nullable = false)
    private String name;

    /**
     * 商品描述
     */
    @Column(name = "description", length = 1000)
    private String description;

    /**
     * 商品价格
     */
    @Column(name = "price", nullable = false, precision = 10, scale = 2)
    private BigDecimal price;

    /**
     * 商品库存
     */
    @Column(name = "stock", nullable = false)
    private Integer stock;

    /**
     * 商品图片URL
     */
    @Column(name = "image_url")
    private String imageUrl;

    /**
     * 商品状态：0-下架，1-上架
     */
    @Column(name = "status", nullable = false)
    private Integer status = 1;

    /**
     * 商品分类ID
     */
    @Column(name = "category_id")
    private Long categoryId;
}